package com.gdufe.uaa.config;

import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

import java.time.Duration;

@Configuration
public class RestTemplateConfig {

	/**
	 * 调度器使用的RestTemplate，超时2min
	 * @return
	 */
	@Bean("dispatcherRestTemplate")
	public RestTemplate getRestTemplate(){
		RestTemplate restTemplate = new RestTemplateBuilder()
					.setConnectTimeout(Duration.ofMinutes(2))
					.setReadTimeout(Duration.ofMinutes(2))
					.build();
		return restTemplate;
	}
}
